<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            margin: 10px auto;
            display: grid;
            grid-template-rows: 100px 100px 100px;
            grid-template-columns: 100px 100px 100px;
            background-color: #f00;
        }
        .box div{
            background-color: #0f0;
            border: 1px solid yellow;
        }
        .box1{
            margin: 10px auto;
            width: 600px;
            display: grid;
            grid-template-rows: repeat(3,1fr);
            grid-template-columns: repeat(3,1fr);
            grid-template-areas: 
            'a1 a1 a1'
            'a2 a2 a3'
            'a2 a2 a3';
            grid-gap: 10px 10px;
        }
        .box1 div:nth-child(1){
            grid-area: a1;background-color: #f00;}
        .box1 div:nth-child(2){grid-area: a2;background-color: #0f0;}
        .box1 div:nth-child(3){grid-area:a3;background-color: #00f;}

        .box2{
            display: grid;
            width: 600px;
            height: 600px;
            margin: 20px auto;
            border: 2px dashed grey;
            grid-template-rows: repeat(3,100px);        
            grid-template-columns: repeat(3,100px);  
            /* 靠左/靠右/居中/平铺 呈现方式 水平方向 */
            justify-items: start;
            /* justify-items: end;
            justify-items: center; */
            justify-items: stretch;

            /* 竖直方向 */
            align-items: center;
            align-items: stretch;
            /* align-items: end; */
            /* align-items: start; */

            /* 水平排列 对整体 */
            justify-content: space-between;
            justify-content: start;
            justify-content: end;
            justify-content: center;
            justify-content: stretch;
            justify-content: space-around;
            justify-content: space-evenly;
            
            /* 竖直排列 */
            align-content: end;
        }
        .box2 div{
            border: 1px red dashed;
            background-color: pink;
        }
        .c{
            display: grid;
            grid-template-columns: repeat(4,100px);
            grid-template-rows: repeat(3,100px);
            border: 1px solid red;

        }
        .c div{
            background-color: black;
            grid-column: 3/4;
            grid-row: 2/3;
        }
    </style>
</head>
<body>
    <div class="box">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
        <div>9</div>
        网格布局
    </div>
    <div class="box1">
        <div>1</div>
        <div>2</div>
        <div>3</div>
    </div>
    <div class="box2">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
        <div>9</div>
    </div>
    <div class="c">
        <div>564</div>
    </div>
</body>
</html>